{extend name="common:base"/}
{block name="body"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <h2>系统设置</h2>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{present name="info"}编辑{else /}新增{/present}菜单</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i> 
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div> 
                </div>
                <div class="ibox-content p-xl-important">
                    <form class="form-horizontal" id="signupForm" method="post" action="{:\\think\\Url::build('Menu/renew')}" >
                        <div class="form-group input-large">
                            <label class=" control-label">标题<span class="check-tips">（用于后台显示的配置标题）</span></label>
                            <input id="title" class="form-control" type="text" name="title" value="{$info.title|default=''}">
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">排序<span class="check-tips">(用于分组显示的顺序)</span></label>
                            <input  class="form-control" type="text" name="sort" value="{$info.sort|default=0}">
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">链接<span class="check-tips">(函数解析的URL或者外链)</span></label>
                            <input id="url" class="form-control" type="text" name="url" value="{$info.url|default=''}">
                        </div>
                        <div class="form-group input-large">
                            <label class="control-label">上级菜单<span class="check-tips">(所属的上级菜单)</span></label>
                            <select name="pid" data-placeholder="顶级菜单" class="chosen-select form-control" tabindex="-1">
                                {notempty name='menus'}
                                {volist name="menus" id="menu"}
                                <option value="{$menu.id}">{$menu.title_show}</option>
                                {/volist}
                                {/notempty}
                            </select>
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">分组<span class="check-tips">(用于左侧分组二级菜单)</span></label>
                            <input class="form-control" name="group" value="{$info.group|default=''}">
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">是否隐藏<span class="check-tips"></span></label>
                            <div class="radio i-checks ">
                                <label><input type="radio" value="1" name="hide"> <i></i> 是</label> 
                                <label><input type="radio" checked value="0" name="hide"> <i></i>否</label> 
                            </div>
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">仅开发者模式可见<span class="check-tips"></span></label>
                            <div class="radio i-checks">
                                <label><input type="radio" value="1" name="is_dev"> <i></i> 是</label>
                                <label><input type="radio" checked value="0" name="is_dev"> <i></i> 否</label>
                            </div>
                        </div>
                        <div class="form-group input-large">
                            <label class=" control-label">说明<span class="check-tips">(菜单详细说明)</span></label>
                            <input class="form-control " type="text" name="tip" value="{$info.tip|default=''}">
                        </div>
                        <div class="form-group">
                            <input type="hidden" name="id" value="{$info.id|default=''}">
                            <button class="btn btn-w-m btn-primary" target-form="form-horizontal" type="submit">提交</button>
                            <button class="btn btn-w-m btn-default retreat">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
{/block}
{block name="css"}
<link href="__CSS__/plugins/iCheck/custom.css" rel="stylesheet">
<link href="__CSS__/plugins/chosen/chosen.css" rel="stylesheet">
{/block}
{block name="script"}
<!-- 选择js 加载-->
<script type="text/javascript" src="__JS__/detail.js"></script>
<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
<script src="__JS__/plugins/validate/messages_zh.min.js"></script>
<!-- Chosen -->
<script src="__JS__/plugins/chosen/chosen.jquery.js"></script>
<!-- iCheck -->
<script src="__JS__/plugins/iCheck/icheck.min.js"></script>
<script type="text/javascript">
    $(function () {
        highlight_subnav("{:\\think\\Url::build('menu/index')}");
        static7.setChoose("pid", "{$pid|default=0}");
        $(".chosen-select").chosen({
            no_results_text: "没有找到",
            allow_single_de: true
        });
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green'
        });
        $("#signupForm").validate({
            rules: {
                title: {
                    required: true,
                    minlength: 2
                },
                url: "required"
            },
            messages: {
                title: {
                    required: '标题不能为空',
                    minlength: '至少两个字符以上'
                },
                url: {
                    required: "链接不能为空"
                }
            },
            submitHandler: function () {
                validateAjax("#signupForm","button[type='submit']");
                return false;
            }
        });
    });
</script>
{/block}